package com.dz.xjd.ui.activity;

import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import com.dz.xjd.R;
import com.dz.xjd.ui.base.BaseActivity;
import com.dz.xjd.utils.ToastUtil;
import butterknife.BindView;
import butterknife.OnClick;

public class LoanApplicationActivity extends BaseActivity {

    @BindView(R.id.layout_top_tv_left)
    TextView mTvTitleBack;

    @BindView(R.id.layout_top_tv_title)
    TextView mTvtitle;

    @BindView(R.id.tv_money_total)
    TextView mTvTotal;

    @BindView(R.id.rg_group_money)
    RadioGroup mRgMoney;

    @BindView(R.id.rg_group_day)
    RadioGroup mRgDay;


    @BindView(R.id.rbt_application_money1)
    RadioButton mRbMoney1;

    @BindView(R.id.rbt_application_money2)
    RadioButton mRbMoney2;

    @BindView(R.id.rbt_application_day1)
    RadioButton mRbDay1;

    @BindView(R.id.rbt_application_day2)
    RadioButton mRbDay2;

    @BindView(R.id.btn_application_next)
    Button mBtnNext;


    @Override
    protected int getLayout() {
        return R.layout.activity_loan_application;
    }

    @Override
    protected void init() {
        mTvtitle.setText("借款申请");
        mRgMoney.setOnCheckedChangeListener(mCheckedChangeListener);
        mRgDay.setOnCheckedChangeListener(mCheckedChangeListener);
    }

    @Override
    public void initPresenter() {
       /* mPresenter.setVM(this, mModel);*/
    }

private RadioGroup.OnCheckedChangeListener mCheckedChangeListener = new RadioGroup.OnCheckedChangeListener(){

    @Override
    public void onCheckedChanged(RadioGroup group, int checkedId) {// Q: 参数 group 暂时还没搞清什么用途

        if (group.getId() == R.id.rg_group_money){
            if(checkedId == R.id.rbt_application_money1){
                ToastUtil.showShort("500");
            }else{
                ToastUtil.showShort("1000");
            }
        }else{
            if(checkedId == R.id.rbt_application_day1){
                ToastUtil.showShort("7day");
            }else{
                ToastUtil.showShort("14day");
            }
        }
    }
};

    @OnClick({R.id.btn_application_next, R.id.layout_top_tv_left})
    void onClick(View v) {
        switch (v.getId()){
            case R.id.layout_top_tv_left :
                onBackPressed();
                break;
            case R.id.btn_application_next :
                nextSubmit();
                break;
        }
    }

    private void nextSubmit() {

    }


}
